﻿<cfsilent>
	<cfscript>
		
		sql = "SELECT 
					c.institute_id, 
					c.institute_name 
				FROM t_class a 
					 INNER JOIN t_subject b ON b.sbj_id = a.sbj_id 
					 INNER JOIN t_institute c ON c.institute_id = b.institute_id  
				GROUP BY 
					c.institute_id, 
					c.institute_name 
				ORDER BY c.institute_name";
				
		queryObj = new query( datasource=application.dnsSlave);
		
		rs_ins = queryObj.execute( sql=sql ).getResult();

		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		propertyAdvice = getProperty("serviceFactory").getBean("studentPropertyAdvice");
		
		event.setArg("pageTitle", "教学运行基础数据 - 学生学籍管理");
		
		currentTab = event.getArg("TabID", "labDepartment");
		
		targetArgs = structNew();
		passArgs = structNew();
		
		/* 搜索学生档案 */
		/* 搜索学生档案 */
		cases = event.getArg("cases");
		HSQL = "";
		keyword = trim(event.getArg("Keywords")) ;
		
		if( cases eq "" OR cases eq "1"){
			cases = "1";
			keyword = ucase(keyword);
			HSQL = "upper( ";
		}else if( cases eq "2"){
			keyword = lcase(keyword);
			HSQL = "Lower( ";
		}else{
			HSQL = "(";
		}
		
		structInsert(passArgs,"cases", cases );
		
		rs_student = queryNew("stu_id");
		
		if ( len(keyword) ) {
			
			
			sql = "SELECT 
						 " & HSQL & " t_student.stu_id ) stu_id,
						 " & HSQL & " t_student.stu_name_english ) stu_name_english, 
						 " & HSQL & " t_student.NATIONALITY ) NATIONALITY, 
						 " & HSQL & " t_student.stu_idcard ) stu_idcard, 
						 " & HSQL & " t_student.stu_name ) stu_name, 
						 " & HSQL & " t_student.stu_sex ) stu_sex, 
						 t_student_status.student_prop 
					FROM 
						 t_student 
						 INNER JOIN t_student_status ON t_student_status.stu_id = t_student.stu_id 
					WHERE 
						 (
							 " & HSQL & " t_student.stu_id ) LIKE :condition 
							 OR 
							 " & HSQL & " t_student.stu_name ) LIKE :condition 
							 OR 
							 " & HSQL & " t_student.stu_name_english ) LIKE :condition 
							 or 
							 " & HSQL & " T_STUDENT.stu_idcard ) LIKE :condition 
							 OR 
							 " & HSQL & " t_student.NATIONALITY ) like :condition 
						 )
					ORDER BY 
						 t_student.stu_name ";
			
			queryObj = new Query( datasource=application.dnsSlave, maxRows=30 );
			queryObj.addParam( name="condition", value="%"&keyword&"%", cfsqltype="cf_sql_varchar" );
			
			rs_student = queryObj.execute( sql=sql ).getResult();
	
						
		}

	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('studentStatusChange')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">学籍异动</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 application"></i>学籍档案
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labDepartment">class="active"</cfif> id="labDepartment" tabTarget="Department">学生学院</span>
						<span <cfif currentTab eq "labImport">class="active"</cfif> id="labImport" tabTarget="Import">导入学生数据</span>
						<span <cfif currentTab eq "labSearch">class="active"</cfif> id="labSearch" tabTarget="Search">搜索学生档案</span>
						<span <cfif currentTab eq "labClean">class="active"</cfif> id="labClean" tabTarget="Clean">根据学号删除未报到新生数据</span>
						<!---<span <cfif currentTab eq "labCleanIDCard">class="active"</cfif> id="labCleanIDCard" tabTarget="CleanIDCard">根据身份证号删除未报到新生数据</span>--->
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="Department" class="tabContent">

                    <cfloop query="rs_ins" >
						
						<div class="noticeBlock">
							<cfif rs_ins.institute_id eq rs_ins["institute_id"][1]>
								<div class="operation">
									<a class="uiButton" href="<cfoutput>#buildURL('classFlush')#</cfoutput>"><i class="mrs img btnExecute"></i><span class="uiButtonText">刷新班级人数</span></a>
								</div>
							</cfif>
							<h3><cfoutput>#rs_ins.institute_name#</cfoutput></h3>
							<p><span class="img icon16x16 message"></span>点击专业名称查看行政班分布情况</p>
							<hr/>
						</div>
						
						<cfset sql  = "SELECT 
											  b.sbj_id, b.sbj_name, 
											  b.term_start, b.level_code, 
											  count(a.cls_id) cls_Count
										FROM t_class a 
											INNER JOIN t_subject b ON b.sbj_id = a.sbj_id  
										WHERE b.institute_id = :depID 
										GROUP BY 
											b.sbj_id, b.sbj_name, 
											b.term_start, b.level_code
										ORDER BY 
											b.sbj_name"/>
											
						<cfset queryObj = new Query( datasource=application.dnsSlave )/>
                        <cfset queryObj.addParam( name="depID", value=rs_ins.institute_id, cfsqltype="cf_sql_varchar" )/>
						
                        <cfset rs_subject = queryObj.execute( sql=sql ).getResult()/>
						<div class="clearfix">
							<div class="UICardTable">
                                <cfloop query="rs_subject" >
									<cfset structInsert(targetArgs, "SubID", rs_subject.sbj_id, true) />
									<dl>

										<dt>
											<a href="<cfoutput>#buildURL('studentBySubject', targetArgs)#</cfoutput>">
												<em class="subject"><!--imgholder--></em>
												<dd>
													<h3><cfoutput>#rs_subject.sbj_name#</cfoutput></h3>
													<div><cfoutput>#dictAdvice.getTermEnrol(rs_subject.term_start)#-#dictAdvice.getStudentLevel(rs_subject.level_code)#-#rs_subject.cls_Count#个行政班</cfoutput></div>
												</dd>
											</a>
										</dt>
									</dl>
								</cfloop>
							</div>
						</div>
						
					</cfloop>
					
				</div>

				<div id="Import" class="tabContent">
					
					<div class="noticeBlock">
						<h3>导入学生学籍数据</h3>
						<p><span class="img icon16x16 message"></span>请严格按照如下的数据模板在电子表格文件中录入学生基础数据. 点击<a href="<cfoutput>#buildURL('importStudentTemplate')#</cfoutput>">下载学生基础信息录入模板</a>, 在录入信息时请勿更改第一行表头内容.</p>
						
                              <p><span class="img icon16x16 link"></span>必填信息（<font color="#FF0000">注意：学号一旦导入不能修改，务必确认学号正确</font>）</p>
						<table>
							<tr>								
								<td>学号</td><td>护照名</td><td>性别</td><td>护照号</td><td>国籍</td><td>学生类型</td>
							</tr>
							<tr>
								<td>自行编定</td><td>护照名</td><td>男/女</td><td>护照号</td><td>国家名字</td><td>学生类型名称</td>
							</tr>
						</table>
						<br/>
						<p><span class="img icon16x16 link"></span>选填信息（<font color="#FF0000">注意：入学时间会参与学生成绩打印业务，最好填上</font>）</p>
						<table>
							<tr>
                                   	<td>中文名</td>
								<td>出生日期</td>
								<td>入学日期</td>
                                        <td>护照有效期</td>
                                        <td>婚姻状况</td>
								<td>家庭住址</td>
                                        <td>在华住址</td>
                                       	<td>邮件</td>
                                       	<td>电话</td>
                                        <td>经费来源</td>
							</tr>
							<tr>
                                   	<td>中文名字</td>
								<td>YYYYMMDD</td>
								<td>YYYYMMDD</td>
                                        <td>YYYYMMDD</td>
                                        <td>已婚/未婚</td>
								<td>家庭通讯地址</td>
                                        <td>在华住址</td>
                                        <td>邮件</td>
                                        <td>电话</td>
                                        <td>经费来源名称</td>
							</tr>
						</table>
						<hr/>
					</div>
					
					<form target="output" onSubmit="javascript:return processVerfiyForm('formImport');" id="formImport" class="formWrapper" method="post" enctype="multipart/form-data" action="<cfoutput>#buildURL('importStudentDo')#</cfoutput>">
						
						<div class="label">
							<span class="req">*</span><b>导入数据文件</b>
							<input name="upload" id="upload" type="file" verification="required" />
						</div>
						
						<div class="lable"><input id="importTrigger" class="button" type="submit" value="导入学籍数据" /></div>
					</form>
					
					<script language="javascript" type="text/javascript">
						//<![CDATA[
						<!--
						$(document).ready(function() {
							$("#importTrigger").click(function(){
								$("#output").attr("src","about:blank").removeClass("hidden_elem");
							});
						});
						// -->
						//]]>
					</script>
					
					
					<iframe name="output" id="output" class="UIframeBox hidden_elem" src="about:blank" frameborder="0"></iframe>
					
				</div>
				
				<div id="Search" class="tabContent">
                    
                    	<form id="formSearch" onSubmit="javascript:return processVerfiyForm('formSearch');" class="formWrapper Transparent" method="post" action="<cfoutput>#buildURL('studentProfile',passArgs)#</cfoutput>">
                                   <input type="hidden" name="TabID" value="labSearch" />
                                   
                                   <div class="label">
                                        <b>学号、中文名、国家、<br/>护照名、护照号</b>
                                        <input name="Keywords" id="Keywords" type="text" class="typeText" verification="required" maxlength="128" value="<cfoutput>#event.getArg('Keywords')#</cfoutput>" />
                                        <input name="cases" id="cases" type="radio" class="typeRadio" verification="required" maxlength="128" value="1" <cfif event.getArg('cases', '1') eq 1>checked="checked"</cfif> />大写显示
                                         <input name="cases" id="cases" type="radio" class="typeRadio" verification="required" maxlength="128" value="2" <cfif event.getArg('cases', '1') eq 2>checked="checked"</cfif>/>小写显示
                                          <input name="cases" id="cases" type="radio" class="typeRadio" verification="required" maxlength="128" value="3" <cfif event.getArg('cases', '1') eq 3>checked="checked"</cfif>/>正常显示
                                   </div>
                                   <hr/>
                                   <div class="lable">
                                        <input class="button1" type="submit" value="搜索" />
                                   </div>
                              </form>
                              
                              <cfif rs_student.recordCount>
     
                              
                                        <cfset row = 0 />
                                        <table class="UIEditable">
                                             <thead>
                                                  <tr>
                                                       <td width="18"></td>
                                                       <td>学号</td>
                                                       <td>中文名</td>
                                                       <td>性别</td>
                                                       <td>护照名</td>
                                                       <td>护照号</td>
                                                       <td>国籍</td>
                                                       <td width="18"></td>
                                                  </tr>
                                             </thead>
                                             <tbody>
                                                  <cfloop query="rs_student">
                                                  
                                                       
                                                       <cfset row++ />
                                                       
                                                       <cfset structInsert(passArgs, "STU", rs_student.stu_id, true) />
                                                       <cfset structInsert(passArgs,"Keywords", keyword,true ) />
                                                       
                                                       <cfset propertyAdvice.parseProperty(rs_student.student_prop) />
                                                       
                                                       <tr class="editRows <cfif not propertyAdvice.getInSchool()>alertRow</cfif>">
                                                            <td class="index"><cfoutput>#row#</cfoutput></td>
                                                            <td><cfoutput>#replace(rs_student.stu_id,keyword,"<font color=red>" & keyword & "</font>")#</cfoutput></td>
                                                            <td><cfoutput>#replace(rs_student.stu_name,keyword,"<font color=red>" & keyword & "</font>")#</cfoutput></td>
                                                            <td><cfif rs_student.stu_sex eq "1">男<cfelse>女</cfif></td>
                                                            <td><cfoutput>#replace(rs_student.stu_name_english,keyword,"<font color=red>" & keyword & "</font>")#</cfoutput></td>
                                                            <td><cfoutput>#replace(rs_student.stu_idcard,keyword,"<font color=red>" & keyword & "</font>")#</cfoutput></td>
                                                            <td><cfoutput>#replace(rs_student.nationality,keyword,"<font color=red>" & keyword & "</font>")#</cfoutput></td>
                                                            <td><a href="<cfoutput>#buildURL('studentProfileView', passArgs)#</cfoutput>" class="stat select"></a></td>
                                                           
                                                       </tr>
                                                  </cfloop>
                                             </tbody>
                                        </table>
                                                                                     
                              
                              </cfif>
					
				</div>
				
				<div id="Clean" class="tabContent">
					
					<div class="noticeBlock">
						<h3>删除未报到新生学籍</h3>
						<p><span class="img icon16x16 message"></span>如录取名单的学生未按规定时间进校报到, 或学生放弃就读学籍, 您可以在这里对无效学籍信息进行批量删除.</p>
						<hr/>
					</div>
					
					
					
					<form id="formClean" onSubmit="javascript:return processVerfiyForm('formClean');" class="formWrapper" method="post" action="<cfoutput>#buildURL('studentProfileCleanDo')#</cfoutput>">
						<input type="hidden" name="targetTab" value="labClean" />
						
						<div class="label">
							<span class="req">*</span><b>学生学号</b>
							<textarea name="StudentIDs" id="StudentIDs" verification="required"></textarea>
							<p class="notice">如有多个学号, 请使用 , 或者 换行方式进行区分</p>
							<p class="notice1">注意! 删除学籍数据会同时删除选课, 成绩, 档案等所有学生相关信息, 您应该在学校的新生报到工作完全结束后再进行数据删除操作.</p>
						</div>
						
						<hr/>
						
						<div class="lable">
							<input class="button5" type="submit" value="删除学生档案" />
						</div>
					</form>
					
				</div>
				<!--- 描述：增加根据身份证号删除未报到新生数据功能 修改时间：2013-09-24 修改人：wenhaibo  --->
				<div id="CleanIDCard" class="tabContent">
					<div class="noticeBlock">
						<h3>删除未报到新生学籍</h3>
						<p><span class="img icon16x16 message"></span>如录取名单的学生未按规定时间进校报到, 或学生放弃就读学籍, 您可以在这里对无效学籍信息进行批量删除.</p>
						<hr/>
					</div>
					
					
					
					<form id="formCleanIDCard" onSubmit="javascript:return processVerfiyForm('formCleanIDCard');" class="formWrapper" method="post" action="<cfoutput>#buildURL('studentIDCardProfileCleanDo')#</cfoutput>">
						<input type="hidden" name="targetTab" value="labClean" />
						
						<div class="label">
							<span class="req">*</span><b>学生身份证号</b>
							<textarea name="IDCards" id="IDCards" verification="required"></textarea>
							<p class="notice">如有多个身份证号, 请使用 , 或者 换行方式进行区分</p>
							<p class="notice1">注意! 删除学籍数据会同时删除选课, 成绩, 档案等所有学生相关信息, 您应该在学校的新生报到工作完全结束后再进行数据删除操作.</p>
						</div>
						
						<hr/>
						
						<div class="lable">
							<input class="button5" type="submit" value="删除学生档案" />
						</div>
					</form>
					
				</div>
			</div>
		</li>
	</ul>
</div>



